import ReactDOM from 'react-dom'
import { Icon } from 'antd'

export default Target => {
  const m = document.createElement('div')

  const remove = () => {
    document.body.removeChild(m)
  }

  const useTarget = Target => {
    return (
      <>
        <Icon type="close-circle" onClick={remove} />
        <div className='content'>
          <Target />
        </div>
      </>
    )
  }

  m.id = 'modalinfo'
  document.body.appendChild(m)
  ReactDOM.render(useTarget(Target), m)
}
